package com.imooc.demo;


import java.lang.reflect.Constructor;

/**
 * Created by joe on 16-7-29.
 */

public class MainTest {

	public static void main(String[] args) throws Exception {
//		Class d1 = Class.forName("java.util.Date");
//		System.out.println(d1);

//		Class<?> cls = Class.forName("com.imooc.pojo.Book");
//		Object o = cls.newInstance();//无参的构造参数
//		Book b = (Book) o;
//6
//		System.out.println(b);
		Class<?> cls = Class.forName("com.imooc.pojo.Book");
		//获取构造参数     public Book(String name,double price),找到类型
		Constructor<?> con = cls.getConstructor(String.class,double.class);
		Object obj = con.newInstance("java开发",88.2);
		System.out.println(obj);

	}


}
